package Impl;

import Bean.BeanStudent;
import Dao.StudentDao;
import Service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;

@Service("StudentServiceImpl")
public class StudentServiceImpl implements StudentService {
    @Resource(name="StudentDAO")
    StudentDao studentDao;

    public StudentDao getStudentDao() {
        return studentDao;
    }

    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    @Override
    public BeanStudent getStudent(int id) throws Exception {
        return studentDao.getStudent(id);
    }

    @Override
    public ArrayList<BeanStudent> getStudentsByUser(String id) throws Exception {
        return studentDao.getStudentsByUser(id);
    }

    @Override
    public void addStudent(BeanStudent student) throws Exception {
        studentDao.addStudent(student);
    }
}
